<template>
  <div>
    <div>
      订单来源：
      <Select v-model="searchData.source_id" style="width: 180px">
        <Option v-for="item in sourceArr" :value="item.id" :key="item.id" border>{{ item.title }}</Option>
      </Select>
      订单编号：
      <Input v-model="searchData.order_sn" style="width: 211px"></Input>
      手机号：
      <Input v-model="searchData.user_mobile" style="width: 110px"></Input>
      预留手机号：
      <Input v-model="searchData.mobile" style="width: 110px"></Input>
      城市：
      <Select v-model="searchData.city_id" filterable style="width: 150px" @on-change="cityChange" :label-in-value="true">
        <Option :value="val.id" v-for="val in cityArr" :key="val.id">{{ val.name }}</Option>
      </Select>
      教练姓名：
      <Select v-model="searchData.coach_user_id" filterable style="width: 150px">
        <Option :value="val.id" v-for="val in coachArr1" :key="val.id">{{ val.username }}</Option>
      </Select>
      订单状态：
      <Select v-model="searchData.status" style="width: 180px">
        <Option :value="key" v-for="(val, key) in orderStatusArr" :key="key">{{ val }}</Option>
      </Select>
    </div>
    <div style="margin-top: 10px;">

      预约时间：
      <Date-picker type="daterange" placeholder="开始日期" v-model="searchData.reserve_time"></Date-picker>
      下单时间：
      <Date-picker type="daterange" placeholder="开始日期" v-model="searchData.create_time"></Date-picker>

      <Button @click="search" type="primary" style="margin-left: 10px;">搜索</Button>
      <Button @click="reset" type="success" style="margin-left: 10px;">重置</Button>
      <Button @click="add(false)" type="info" style="margin-left: 10px;">添加</Button>
    </div>

    <br>
    <Table :columns="columns" :data="list" border size="small" :row-class-name="rowClassName">
      <template slot-scope="{ row , index}" slot="userSlot">
        <div style="display: flex;flex-direction: column;align-items: flex-start;">
          <div><span style="font-weight: bold;">姓名：</span>{{ row.username }}</div>
          <div><span style="font-weight: bold;">手机号：</span>{{ row.user_mobile }}</div>
          <div><span style="font-weight: bold;">预留手机号：</span>{{ row.mobile }}</div>
        </div>
      </template>
      <template slot-scope="{ row , index}" slot="coachSlot">
        <div><span style="font-weight: bold;">姓名：</span>{{ row.partner_name }}</div>
        <div><span style="font-weight: bold;">手机号：</span>{{ row.partner_mobile }}</div>
        <div><span style="font-weight: bold;">工资：</span>{{ row.coach_amount }}</div>

      </template>
      <template slot-scope="{ row , index}" slot="courseSlot">
        <div v-if="row.source_id > 1 && row.status != 1" style="background-color: yellow;">
          <div><span style="font-weight: bold;">编号：</span> {{ row.order_sn }}</div>
          <div><span style="font-weight: bold;">来源：</span> {{ row.source_title }}</div>
        </div>
        <div v-else>
          <div><span style="font-weight: bold;">编号：</span> {{ row.order_sn }}</div>
          <div><span style="font-weight: bold;">来源：</span> {{ row.source_title }}</div>
        </div>
      </template>
      <template slot-scope="{ row , index}" slot="carSlot">
        <div><span style="font-weight: bold;">品牌：</span>{{ row.brand }}</div>
        <div><span style="font-weight: bold;">车况：</span>{{ row.condition_txt }}</div>
        <div><span style="font-weight: bold;">车型：</span>{{ row.car_type_txt }}</div>
      </template>
      <template slot-scope="{ row , index}" slot="paySlot">
        <div><span style="font-weight: bold;">套餐名称：</span> {{ row.menu_name }}</div>
        <div><span style="font-weight: bold;">套餐金额：</span> {{ row.menu_price }}</div>
        <div><span style="font-weight: bold;">支付金额：</span> {{ row.pay_amount }}</div>
      </template>
      <template slot-scope="{ row , index}" slot="menuSlot">
        <div><span style="font-weight: bold;">套餐时长:</span>{{ row.menu_total }}小时</div>
        <div><span style="font-weight: bold;">套餐剩余：</span>{{ row.menu_total - row.menu_used }}小时</div>
      </template>
      <template slot-scope="{ row , index}" slot="feeSlot">
        <div>
          <span style="font-weight: bold;">金额：</span>
          {{ row.is_trial == 1 ? row.partner_trial_class_amount : row.partner_class_amount }} * {{ row.duration }}
          =
          {{ row.is_trial == 1 ? row.partner_trial_class_amount * row.duration : row.partner_class_amount *
            row.duration }} 元
        </div>
      </template>
      <template slot-scope="{ row , index}" slot="memberSlot">
        <div>
          <div>
            <Button @click="add(row)" type="primary" size="small" style="margin-left: 5px;">编辑</Button>
            <Button @click="copyText(row)" type="info" size="small" style="margin-left: 5px;">复制</Button>
            <Button @click="detail(row)" v-if="row.status == 7" type="error" size="small"
              style="margin-left: 5px;">验券</Button>
            <Button @click="cancel(row.id)" v-if="row.status == 1 || row.status == 2 || row.status == 3" type="error"
              size="small" style="margin-left: 5px;">取消</Button>
            <Button @click="del(row.id)" type="error" size="small" style="margin-left: 5px;">删除</Button>
          </div>
          <div style="margin-top: 5px;">
            <Button @click="designOrder(row.id)" v-if="row.status == 1" type="primary" size="small"
              style="margin-left: 5px;">派单</Button>
            <Button @click="designOrder(row.id)" v-if="row.status == 2 || row.status == 3" type="warning" size="small"
              style="margin-left: 5px;">改派</Button>
            <Button @click="uploadCode(row.id)" v-if="(row.status == 3 || row.status == 8)" type="primary" size="small"
              style="margin-left: 5px;">上传券码</Button>
            <Button @click="removeShow(row.id, row.remark)" v-if="row.status == 2 || row.status == 3" type="error"
              size="small" style="margin-left: 5px;">放置大厅</Button>
          </div>

        </div>
      </template>
    </Table>
    <Paginate :total="total" @on-change="changePage" @on-page-size-change="changeSize">
    </Paginate>

    <!-- 添加订单 -->
    <Modal title="验车订单" :width="40" v-model="showAdd" :mask-closable="false">
      <Form ref="formValidate" :model="orderInfo" :label-width="80">
        <FormItem label="订单来源">
          <radioGroup v-model="orderInfo.source_id">
            <Radio v-for="item in sourceArr" :label="item.id" :key="item.id" border>{{ item.title }}</Radio>
          </radioGroup>
        </FormItem>
        <FormItem label="城市">
          <Select v-model="orderInfo.city_id" filterable @on-change="cityChange" :label-in-value="true">
            <Option :value="val.id" v-for="val in cityArr" :key="val.id">{{ val.name }}</Option>
          </Select>
        </FormItem>
        <FormItem label="详细地址">
          <!-- <Input v-model="orderInfo.address" type="text" @on-focus="showMapModal = true"></Input> -->
          <Input v-model="orderInfo.address" type="text"></Input>
        </FormItem>
        <FormItem label="预约时间">
          <Date-picker type="datetime" placeholder="开始日期" v-model="orderInfo.reserve_time" :options="options3"
            :time-picker-options="stepOption" @on-change="dataChange"></Date-picker>
        </FormItem>
        <FormItem label="车况类型">
          <radioGroup v-model="orderInfo.condition">
            <Radio :label="1">新车</Radio>
            <Radio :label="2">二手车</Radio>
          </radioGroup>
        </FormItem>
        <FormItem label="车辆品牌">
          <Input v-model="orderInfo.brand"></Input>
        </FormItem>
        <FormItem label="动力类型">
          <radioGroup v-model="orderInfo.cart_type">
            <Radio :label="1">油车</Radio>
            <Radio :label="2">电车</Radio>
            <Radio :label="3">混动车</Radio>
          </radioGroup>
        </FormItem>
        <FormItem label="套餐">
          <!-- <Input v-model="orderInfo.menu_name"></Input> -->
          <Select v-model="orderInfo.menu_id" filterable>
            <Option :value="val.id" v-for="val in menuArr" :key="val.id">{{ val.name }}</Option>
          </Select>
        </FormItem>
        <FormItem label="姓名">
          <Input v-model="orderInfo.username" placeholder="请输入用户姓名"></Input>
        </FormItem>
        <FormItem label="手机号" prop="mobile">
          <Input v-model="orderInfo.mobile" placeholder="请输入用户手机号"></Input>
        </FormItem>
        <FormItem label="备注">
          <Input v-model="orderInfo.remark" type="textarea" :rows="4"></Input>
        </FormItem>

      </Form>
      <div slot="footer">
        <Button type="primary" size="large" long @click="addSubmit">确定</Button>
      </div>
    </Modal>

    <!-- 指派教练 -->
    <Modal title="教练列表" width="50" v-model="showPartnerTable" @on-ok="submit">
      手机号：
      <Input v-model="partnerSearch.mobile" style="width: 180px"></Input>
      姓名：
      <Input v-model="partnerSearch.username" style="width: 180px"></Input>
      <Button @click="search1" type="primary" style="margin-left: 10px;">搜索</Button>
      <Button @click="reset" type="success" style="margin-left: 10px;">重置</Button>
      <br>
      <br>
      <Table :columns="partnerColumns" :data="partnerList" border size="small" :footer-hide="true">
        <template slot-scope="{ row , index}" slot="memberSlot">
          <Button @click="confirm(row.id)" type="primary" size="small" style="margin-left: 5px;">指派</Button>
        </template>
      </Table>
      <Paginate :total="partnerTotal" @on-change="changePage1">
      </Paginate>
      <div slot="footer">
      </div>
    </Modal>
    <!-- 地图 -->
    <Modal title="地图" width="80" v-model="showMapModal">
      <searchsite @getsitemsg="getsitemsgfun" :prefix="city_name"></searchsite>
    </Modal>

    <!-- 放入大厅-->
    <Modal title="备注" width="30" v-model="showRemarkModal" @on-ok="remove">
      <Form ref="formValidate" :model="orderInfo" :label-width="90">
        <FormItem label="取消原因">
          <Select v-model="orderInfo.reason_id" filterable>
            <Option :value="val.id" v-for="val in reasonList" :key="val.id">{{ val.title }}</Option>
          </Select>
        </FormItem>
        <FormItem label="备注">
          <Input v-model="orderInfo.remark" type="textarea" :rows="4"></Input>
        </FormItem>
      </Form>
    </Modal>

    <!-- 取消备注-->
    <Modal title="取消" width="30" v-model="showCancelModal" @on-ok="cancelModal">
      <Form ref="formValidate" :model="orderInfo" :label-width="90">
        <FormItem label="取消原因">
          <Select v-model="orderInfo.reason_id" filterable>
            <Option :value="val.id" v-for="val in reasonList" :key="val.id">{{ val.title }}</Option>
          </Select>
        </FormItem>
        <FormItem label="备注">
          <Input v-model="cancelInfo.remark" type="textarea" :rows="4"></Input>
        </FormItem>
      </Form>
    </Modal>

    <!-- 上传券码-->
    <Modal title="券码" width="40" v-model="showCodeModal" @on-ok="uploadCodeOk">
      <Form ref="formValidate" :model="couponInfo" :label-width="70">
        <FormItem label="填写券码">
          <Input v-model="couponInfo.coupon_code" type="text"></Input>
        </FormItem>
        <FormItem label="图片">
          <MyUpload :maxNumber="1" @getImages="getImg" :defaultImags="[couponInfo.coupon_code_img]"></MyUpload>
        </FormItem>
        <!-- <FormItem label="支付金额">
          <Input v-model="couponInfo.pay_amount" type="number"></Input>
        </FormItem>
        <FormItem label="教练工资">
          <Input v-model="couponInfo.coach_amount" type="number"></Input>
        </FormItem> -->
      </Form>
    </Modal>

    <!-- 详情 -->
    <Modal title="订单详情" width="60" v-model="infoModal">
      <Table :columns="columns1" :data="list1" border stripe size="small">
        <template slot-scope="{ row , index}" slot="userSlot">
          <div v-if="row.type == 1">{{ row.user_name }}</div>
          <div v-if="row.type == 2 || row.type == 3">{{ row.coach_name }}</div>
          <div v-if="row.type == 4 || row.type == 5">{{ row.admin_name }}</div>
        </template>
        <template slot-scope="{ row , index}" slot="coachSlot">
          <div v-if="row.type == 1">用户取消</div>
          <div v-if="row.type == 2">教练拒接</div>
          <div v-if="row.type == 3">教练放置大厅</div>
          <div v-if="row.type == 4">后台取消</div>
          <div v-if="row.type == 5">后台放置大厅</div>
        </template>
      </Table>
      <Paginate :total="total1" @on-change="changePage1">
      </Paginate>
    </Modal>

    <!-- 验券 -->
    <Modal title="订单详情" width="40" v-model="showDtailModal" :mask-closable="false">
      <Form ref="formValidate" :model="couponInfo" :label-width="70">
        <FormItem label="券码">
          <Input v-model="couponInfo.coupon_code" type="text" disabled></Input>
        </FormItem>
        <FormItem label="图片" v-if="couponInfo.coupon_code_img">
          <ShowImg :imgUrl="couponInfo.coupon_code_img"></ShowImg>
        </FormItem>
        <FormItem label="客户支付金额">
          <Input v-model="couponInfo.coach_amount" type="number"></Input>
        </FormItem>
        <FormItem label="状态">
          <radioGroup v-model="couponInfo.status">
            <Radio :label="1">通过</Radio>
            <Radio :label="0">拒绝</Radio>
          </radioGroup>
        </FormItem>
      </Form>
      <div slot="footer">
        <Button type="primary" size="large" long @click="auditCode">确定</Button>
      </div>
    </Modal>

  </div>
</template>

<script>
import Paginate from "_c/paginate";
import searchsite from '@/components/qqmap/searchsite'
import MyUpload from "_c/my-upload"
import ShowImg from '_c/show_img'
import clipboard from 'clipboard';
export default {
  name: "verifyCartList",
  components: {
    Paginate, searchsite, MyUpload, ShowImg
  },
  data() {
    return {
      // 列表
      columns: [
        {
          title: '订单信息',
          align: "left",
          slot: 'courseSlot',
        },
        {
          title: '客户信息',
          align: "left",
          slot: 'userSlot',
        },
        {
          title: '验车师信息',
          align: "left",
          slot: 'coachSlot',
        },

        {
          title: '验车地址',
          align: "left",
          key: "address"
          // slot: 'orderSlot',
        },
        {
          title: '验车时间',
          align: "left",
          key: "reserve_time_txt"
        },
        {
          title: '车辆信息',
          align: "left",
          slot: 'carSlot',
        },
        {
          title: '支付信息',
          align: "left",
          slot: 'paySlot',
        },




        // {
        //     title: '起止时间',
        //     align: "left",
        //     slot: 'orderTimeSlot',
        // },
        {
          title: '订单状态',
          align: "left",
          key: 'order_status_txt',
        },
        // {
        //     title: '课时费',
        //     align: "left",
        //     slot: 'feeSlot',
        // },
        {
          title: '下单时间',
          align: "left",
          key: 'create_time',
        },
        {
          title: '用户备注',
          align: "left",
          key: 'remark',
        },
        {
          title: '操作',
          align: "left",
          key: 'make',
          width: 240,
          slot: 'memberSlot',
        },
      ],
      list: [],
      total: 0,
      searchData: {
        page: 1,
        limit: 10,
        order_type: 2
      },
      // 添加订单
      showAdd: false,
      // 指派教练
      orderInfo: {},
      coachArr: [],
      sourceArr: [],
      cityArr: [],
      coachArr1: [],
      orderStatusArr: [],
      showMapModal: false,
      mapInfo: {},
      // 教练列表
      showPartnerTable: false,
      partnerSearch: {},
      partnerTotal: 0,
      partnerList: [],
      partnerColumns: [
        {
          title: '姓名',
          align: "center",
          key: 'username',
        },
        {
          title: '手机号',
          align: "center",
          key: 'mobile',
        },
        {
          title: '距离',
          align: "center",
          key: 'distance',
        },
        {
          title: '操作',
          align: "left",
          key: 'make',
          width: 240,
          slot: 'memberSlot',
        },
      ],
      // 备注框
      showRemarkModal: false,
      showDtailModal: false,
      orderDetaile: {},
      // 上传券码
      showCodeModal: false,
      couponInfo: {},
      // 取消
      showCancelModal: false,
      cancelInfo: {},
      reasonList: [],
      // 地图
      city_name: '',
      // 记录
      infoModal: false,
      columns1: [
        {
          title: '订单编号',
          align: "left",
          key: 'order_sn',
        },
        {
          title: '名称',
          align: "left",
          slot: 'userSlot',
        },
        {
          title: '操作',
          align: "left",
          slot: 'coachSlot',
        },
        {
          title: '备注',
          align: "left",
          key: 'reason',
        },
        {
          title: '时间',
          align: "left",
          key: 'create_time',
        },
      ],
      list1: [],
      total1: 0,
      searchData1: {
        page: 1,
        limit: 10,
      },
      options3: {
        disabledDate(date) {
          return date && date.valueOf() < Date.now() - 86400000;
        }
      },
      stepOption: {
        steps: [1, 30, 30],
        "hide-disabled-options": true,
        "disabled-hours": []
      },
      menuArr: [],
    }
  },
  methods: {
    getImg(items) {
      items.forEach(item => {
        this.couponInfo.coupon_code_img = item.url;
      });
    },
    rowClassName(row, index) {
      if (row.status === 1) {
        return 'demo-table-error-row';
      }
      return '';
    },
    getList() {
      this.$axios('/admin/partner/reserve/getList', this.searchData).then(res => {
        this.list = res.data;
        this.total = res.total;
      });
    },
    search() {
      this.searchData.page = 1;
      this.getList();
    },
    search1() {
      this.partnerSearch.page = 1;
      this.getPartenrList();
    },
    reset() {
      this.searchData = {
        page: 1,
        limit: 10,
        order_type: 2
      }
      this.getList();
    },
    reset1() {
      this.partnerSearch.username = '';
      this.partnerSearch.mobile = '';
      this.partnerSearch.page = 1;
      this.getList();
    },
    changePage(page) {
      this.searchData.page = page;
      this.getList();
    },
    changePage1(page) {
      this.partnerSearch.page = page;
      this.getPartenrList();
    },
    changePage2(page) {
      this.searchData1.page = page;
      this.getorderLogList();
    },
    changeSize(size) {
      this.searchData.limit = size;
      this.getList();
    },
    customSort(column, key, order) {
      this.searchData.order_by = column.key;
      this.searchData.sort = column.order;
      this.getList();
    },
    add(row) {
      if (row) {
        this.orderInfo = { ...row };
        this.orderInfo.reserve_time = this.orderInfo.reserve_time_txt;
      } else {
        this.orderInfo = {
          condition: 1,
          cart_type: 1,
          is_trial: 1,
          duration: 2,
          source_id: this.sourceArr.length == 0 ? 0 : this.sourceArr[0]['id'],
        };
      }
      // 获取当前时间之前的时间
      // this.stepOption['disabled-hours'] = this.getPreviousHours();
      this.getMenuArr();
      this.showAdd = true;

    },
    dataChange(value) {
      // console.log(value);
      this.stepOption['disabled-hours'] = this.getPreviousHours(value);
    },
    getPreviousHours(date) {
      const timestamp = Date.parse(date);
      const todayStart = new Date();
      todayStart.setHours(0, 0, 0, 0);
      const todayStartTimestamp = todayStart.getTime();

      const hoursArray = [];
      if (timestamp == todayStartTimestamp) {
        const now = new Date();
        const currentHour = now.getHours();
        // console.log(currentHour);
        for (let i = 0; i <= currentHour; i++) {
          hoursArray.push(i);
        }
        // console.log(hoursArray);
        return hoursArray;
      }

    },
    detail(row) {
      this.couponInfo.id = row.id
      this.couponInfo.coupon_code = row.coupon_code
      this.couponInfo.coupon_code_img = row.coupon_code_img
      this.couponInfo.status = 1;
      this.showDtailModal = true;
    },
    designOrder(id) {
      this.partnerSearch = {
        id: id,
        page: 1,
        limit: 10
      };
      this.getPartenrList();
      this.showPartnerTable = true;
    },
    submit() {
      this.$axios('/admin/partner/reserve/setCoach', this.orderInfo).then(res => {
        this.$Message.success('执行成功');
        this.getList();
      });
    },
    timeStampToDate(timestamp) {
      let date = new Date(timestamp * 1000);

      let year = date.getFullYear();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      let hour = date.getHours(); // 获取小时
      let minute = date.getMinutes(); // 获取分钟
      let second = date.getSeconds(); // 获取秒

      return `${year}-${month}-${day} ${hour}:${minute}`;
    },
    // 教练列表
    getCoachArr() {
      this.$axios('/admin/partner/getArr', { type: 1 }).then(res => {
        this.coachArr = res;
      });
    },
    // 订单来源
    orderSourceArr() {
      this.$axios('/admin/config/order_source/getArr').then(res => {
        this.sourceArr = res;
      });
    },
    // 开通城市
    openCityArr() {
      this.$axios('/admin/verify/city/getCityArr').then(res => {
        this.cityArr = res;
      });
    },
    // 订单状态
    getOrderStatusArr() {
      this.$axios('/admin/partner/reserve/getArr').then(res => {
        this.orderStatusArr = res;
      });
    },
    addSubmit() {
      this.$axios('/admin/partner/reserve/createVerifyOrder', this.orderInfo).then(res => {
        this.$Message.success('执行成功');
        this.showAdd = false;
        this.getList();
      });

    },
    removeShow(id, remark) {
      this.orderInfo = {
        id: id,
        remark: remark
      };
      this.showRemarkModal = true;
      this.getReasonList(3);
    },
    // 放入大厅
    remove() {
      this.$axios('/admin/partner/reserve/toPublic', this.orderInfo).then(res => {
        this.$Message.success('操作成功');
        this.getList();
      });
    },
    cancel(id) {
      this.cancelInfo.id = id;
      this.showCancelModal = true;
      this.getReasonList(4);
    },
    cancelModal() {
      this.$axios('/admin/partner/reserve/cancel', this.cancelInfo).then(res => {
        this.$Message.success('操作成功');
        this.getList();
      })
    },
    checkCoupon(row) {
      let code = `<span style='color:red;font-size:20px;'> ${row.coupon_code} </span>`;
      this.$Modal.confirm({
        title: '完成',
        content: "<p>券码是：" + code + "，您确定要完成该订单吗？</p>",
        onOk: () => {
          this.$axios('/admin/partner/reserve/checkCoupon', { id: row.id }).then(res => {
            this.$Message.success('操作成功');
            this.getList();
          })
        },
        onCancel: () => {
          this.$Message.info('取消操作');
        }
      });
    },
    getsitemsgfun(item) {
      this.orderInfo.address = item.city + item.district + item.title;
      this.orderInfo.lng = item.location.lng;
      this.orderInfo.lat = item.location.lat;
      // this.showMapModal = false;
    },
    getPartenrList() {
      this.$axios('/admin/partner/reserve/getNearPartnerList', this.partnerSearch).then(res => {
        this.partnerList = res.data;
        this.partnerTotal = res.total;
      });
    },
    confirm(partnerId) {
      let param = {
        id: this.partnerSearch.id,
        coach_id: partnerId
      };
      this.$axios('/admin/partner/reserve/setCoach', param).then(res => {
        this.$Message.success('执行成功');
        this.showPartnerTable = false;
        this.getList();
      });
    },
    // 上传券码
    uploadCode(id) {
      this.couponInfo.order_id = id;
      this.couponInfo.coupon_code = '';
      this.couponInfo.coupon_code_img = '';
      this.showCodeModal = true;
    },
    uploadCodeOk() {
      if (!this.couponInfo.coupon_code) {
        this.$Message.error('请填写券码');
        return;
      }
      // console.log(this.couponInfo);
      this.$axios('/admin/partner/reserve/uploadVoucher', this.couponInfo).then(res => {
        this.$Message.success('执行成功');
        this.showCodeModal = false;
        this.getList();
      });
    },
    getReasonList(type) {
      this.$axios('/admin/partner/reserve/getReasonList', { type: type }).then(res => {
        this.reasonList = res;
      });
    },
    cityChange(value) {
      if (value) {
        this.city_name = value.label;
        this.getCityCoachArr(value.value);
      }
    },
    getCityCoachArr(city_id) {
      this.$axios('/admin/partner/getArr', { city_id: city_id, type: 1 }).then(res => {
        this.coachArr1 = res;
      });
    },
    copyText(orderDetaile) {
      let text =
        `订单来源：${orderDetaile.source_title}
验车套餐：${orderDetaile.menu_name}
详细地址：${orderDetaile.address}
预约时间：${orderDetaile.reserve_time_txt}
车辆信息: ${orderDetaile.brand},${orderDetaile.condition_txt},${orderDetaile.car_type_txt}
备注：${orderDetaile.remark}`;
      clipboard.copy(text);
      this.$Message.success('复制成功');
    },
    auditCode() {
      this.$axios('/admin/partner/reserve/checkCoupon', this.couponInfo).then(res => {
        this.$Message.success('操作成功');
        this.showDtailModal = false;
        this.getList();
      })
    },
    info(id) {
      this.searchData1.order_id = id;
      this.getorderLogList();
      this.infoModal = true;
    },
    getorderLogList() {
      this.$axios('/admin/partner/reserve_log/getList', this.searchData1).then(res => {
        this.list1 = res.data;
        this.total1 = res.total;
      })
    },
    del(id) {
      this.$Modal.confirm({
        title: '删除操作',
        content: "<p>您确定要删除用户吗？</p>",
        onOk: () => {
          this.$axios('/admin/partner/reserve/del', { id: id }).then(res => {
            this.$Message.success('操作成功');
            this.getList();
          })
        },
        onCancel: () => {
          this.$Message.info('取消操作');
        }
      });
    },
    getMenuArr() {
      this.$axios('/admin/partner/goods/getVerifyCartMenuArr', this.searchData1).then(res => {
        this.menuArr = res;
      })
    },

  },
  created() {
    // 查询自己管理员
    this.getList();
    // this.getCoachArr();
    this.orderSourceArr();
    this.openCityArr();
    this.getOrderStatusArr();
    window.onkeydown = (res) => {
      if (res.key == 'Enter') {
        this.getList();
      }
    }
  },
  beforeDestroy() {
    window.onkeydown = ''
  }
}
</script>
<style>
.ivu-table .demo-table-error-row td {
  background-color: #ff6600;
  color: #fff;
}
</style>


